﻿<%@ Page Language="C#" MasterPageFile="~/Default.master" AutoEventWireup="true" CodeFile="Columns.aspx.cs" Inherits="Columns" Title="<%$Resources:web.sitemap, Columns.Title %>" %>
<%@ Register TagPrefix="Toolbar" TagName="HelpLogout" Src="~/Toolbars/HelpLogoutToolbar.ascx" %>
<%@ Register TagPrefix="Location" TagName="Server" Src="~/Toolbars/ServerLocation.ascx" %>
<%@ Register TagPrefix="Location" TagName="Database" Src="~/Toolbars/DatabaseLocation.ascx" %>
<%@ Register TagPrefix="Location" TagName="Table" Src="~/Toolbars/TableLocation.ascx" %>
<asp:Content runat="server" ContentPlaceHolderID="Breadcrumb">
    <Location:Server Runat="Server" id="ServerLocation"></Location:Server>
    <Location:Database Runat="Server" id="DatabaseLocation"></Location:Database>
    <Location:Table Runat="Server" id="TableLocation" IsActive="true"></Location:Table>
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="NavigationPane">
</asp:Content>
<asp:Content runat="server" ContentPlaceHolderID="ContentPane">
    <div class="RightCenterWell">
        <table width="100%">
            <tr>
                <td valign="top" width="1%">
                    <asp:Image ID="icon_databases_32" SkinID="icon_databases_32" runat="Server" />
                </td>
                <td>
                    <span class="header3"><asp:label id="lblNameProperty" Runat="server"></asp:label>: <asp:Literal ID="columnsLabel" runat=server Text="<%$Resources: LocalizedText,ColumnsLabel %>" /></span><br />
                    <hr />
                    <p>
                    <asp:Literal ID="columnsInstructionLit" runat=Server Text="<%$Resources: LocalizedText, ColumnsInstructions  %>" /></p>
                    <br />
                    <br />
                    <hr />
                    <span class="header4">
                    <asp:Literal ID="AvailColumnsLit" runat="Server" Text="<%$Resources: LocalizedText,ColumnsAvailableColumns %>" />
                   </span>
                    <p>
                      <asp:Literal ID="AvailColumnsInstructionLit" runat="Server" Text="<%$Resources: LocalizedText,ColumnsAvailableColumnsInstructions %>" />
                    <br />
                    <br />                    
                    <asp:Label ID="Label1" Runat="server" ForeColor="red" Visible="False"></asp:Label>
                    </p>	                
	                <div class="TableGrid">
		
					    <asp:datagrid id="dgColumns" runat="server" Border="0" AutoGenerateColumns="False" GridLines="None" Width="97.4%" CellPadding="4" CellSpacing="1" Visible="False">
						    <AlternatingItemStyle CssClass="AlternateTableItem" />
						    <ItemStyle CssClass="TableItem">
						    </ItemStyle>

						    <HeaderStyle CssClass="TableHeader">
						    </HeaderStyle>

						    <Columns>
							    <asp:TemplateColumn HeaderText="Key">
								    <HeaderStyle Wrap="False">
								    </HeaderStyle>

								    <ItemStyle Wrap="False" HorizontalAlign="Center">
								    </ItemStyle>

								    <ItemTemplate>
									    <asp:Image id="Image1" runat="server" ImageUrl="~/images/key.gif" Visible='<%# DataBinder.Eval(Container.DataItem, "InPrimaryKey") %>'></asp:Image>


								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:TemplateColumn HeaderText="ID">
								    <HeaderStyle Wrap="False">
								    </HeaderStyle>

								    <ItemStyle Wrap="False" HorizontalAlign="Center">
								    </ItemStyle>

								    <ItemTemplate>
									    <asp:Image Visible='<%# DataBinder.Eval(Container.DataItem, "Identity") %>' runat="server" ImageUrl="~/images/checkmark.gif" ID="Image2"></asp:Image>

								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:BoundColumn DataField="Name" HeaderText="Name" DataFormatString="{0}">
								    <HeaderStyle Wrap="False">
								    </HeaderStyle>

								    <ItemStyle Wrap="False">
								    </ItemStyle>
							    </asp:BoundColumn>
							    <asp:TemplateColumn HeaderText="Name">
								    <HeaderStyle Wrap="False">
								    </HeaderStyle>

								    <ItemStyle Wrap="False">
								    </ItemStyle>

								    <ItemTemplate>
									    <asp:HyperLink id="Hyperlink1" runat="server" text='<%# DataBinder.Eval(Container.DataItem, "Name") %>' cssclass="databaseListBlack" NavigateUrl='<%# String.Format("editcolumn.aspx?database={0}&table={1}&schema={2}&column={3}", Server.UrlEncode(Request.QueryString["database"]), Server.UrlEncode(Request.QueryString["table"]), Server.UrlEncode(Request.QueryString["schema"]), DataBinder.Eval(Container.DataItem, "Name").ToString()) %>'></asp:HyperLink>

								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:TemplateColumn  HeaderText="Data Type"  >
								    <HeaderStyle Wrap="False">
								    </HeaderStyle>

								    <ItemStyle Wrap="False">
								    </ItemStyle>
								     <ItemTemplate>
									    <%# DataBinder.Eval(Container.DataItem, "DataType.Name") %>

								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:TemplateColumn HeaderText="Size">
								    <HeaderStyle Wrap="False">
								    </HeaderStyle>

								    <ItemStyle Wrap="False">
								    </ItemStyle>

								    <ItemTemplate>
									    <%# DataBinder.Eval(Container.DataItem, "DataType.MaximumLength")%>

								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:TemplateColumn HeaderText="Nulls">
								    <HeaderStyle Wrap="False">
								    </HeaderStyle>

								    <ItemStyle Wrap="False" HorizontalAlign="Center">
								    </ItemStyle>

								    <ItemTemplate>
									    <asp:Image runat="server" ImageUrl='<%# String.Format( "~/images/{0}.gif", (((bool)DataBinder.Eval(Container.DataItem,"Nullable")) == true ? "checkmark" : "checknomark") ) %>' ID="Image3"></asp:Image>

								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:BoundColumn DataField="Default" HeaderText="Default" DataFormatString="{0}">
								    <HeaderStyle Wrap="False">
								    </HeaderStyle>

								    <ItemStyle Wrap="False">
								    </ItemStyle>
							    </asp:BoundColumn>
							    <asp:TemplateColumn HeaderText="Edit">
								    <HeaderStyle Wrap="False" HorizontalAlign="Right">
								    </HeaderStyle>

								    <ItemStyle Wrap="False" HorizontalAlign="Right">
								    </ItemStyle>

								    <ItemTemplate>
									    <asp:HyperLink id="EditColumn" runat="server" text="edit" cssclass="databaseListAction" NavigateUrl='<%# String.Format("EditColumn.aspx?database={0}&table={1}&schema={2}&column={3}", Server.UrlEncode(Request.QueryString["database"]), Server.UrlEncode(Request.QueryString["table"]), Server.UrlEncode(Request.QueryString["schema"]), DataBinder.Eval(Container.DataItem, "Name")) %>'></asp:HyperLink>

								    </ItemTemplate>
							    </asp:TemplateColumn>
							    <asp:TemplateColumn HeaderText="Delete">
								    <HeaderStyle Wrap="False" HorizontalAlign="Right">
								    </HeaderStyle>

								    <ItemStyle Wrap="False" HorizontalAlign="Right">
								    </ItemStyle>

								    <ItemTemplate>
									    <asp:HyperLink id="DeleteColumn" runat="server" text="delete" cssclass="databaseListAction" NavigateUrl='<%# String.Format("DeleteColumn.aspx?database={0}&table={1}&schema={2}&column={3}", Server.UrlEncode(Request.QueryString["database"]), Server.UrlEncode(Request.QueryString["table"]), Server.UrlEncode(Request.QueryString["schema"]), DataBinder.Eval(Container.DataItem, "Name")) %>'></asp:HyperLink>

								    </ItemTemplate>
							    </asp:TemplateColumn>
						    </Columns>
					    </asp:datagrid>
						<asp:label id="lblNoColumns" runat="server" EnableViewState="False" Font-Bold="true" Font-Size="10" Visible="False">There are no columns to display.</asp:label><asp:Label id="lblError" runat="server" Visible="False" ForeColor="red"></asp:Label>
                    </div>
                    <br />
                    <table width="100%" cellspacing="0" cellpadding="0" border="0">
                        <tr>
                            <td align="left">
						        <asp:Button ID="btnAddNewColumn" Text="New Column..." OnClick="btnAddNewColumn_Click" runat="Server" />
                            </td>
                        </tr>
                    </table>
                </td>
            </tr>
        </table>
    </div>

</asp:Content>

